package com.atguigu.gulimall.ware.vo;

import lombok.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * @Description
 * @Author lhj
 * @Date 2024/3/16 11:49
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@EqualsAndHashCode
@ToString
public class CartItemVO implements Serializable {

    private static final long serialVersionUID = 42L;

    /**
     * 商品Id
     */
    private Long skuId;

    /**
     * 选中状态
     */
    private Boolean check = true;

    /**
     * 商品标题
     */
    private String title;
    
    /**
     * 图片地址
     */
    public String image;

    /**
     * 销售属性
     */
    private List<String> skuAttrs;

    /**
     * 价格
     */
    private BigDecimal price;

    /**
     * 数量
     */
    private Integer count;

    /**
     * 总价格
     */
    private BigDecimal totalPrice;

    public BigDecimal getTotalPrice() {
        BigDecimal count = new BigDecimal(String.valueOf(this.count));
        return price.multiply(count);
    }
    
}
